package com.eastedu.repository.assignment.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.eastedu.repository.assignment.po.AssignmentPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * The interface Assignment mapper.
 *
 * @author ZHISHUAI.ZHANG
 * @since 2019 /2/22
 */
@Mapper
@DS("assignment")
public interface AssignmentMapper extends BaseMapper<AssignmentPO> {

    /**
     * Update provider.
     *
     * @param provider the provider
     * @param id       the id
     */
    @Update("UPDATE t_assignment_resource SET owner_id = #{provider}, update_time = update_time + 1 WHERE id = #{id}")
    void updateProvider(@Param("provider") int provider, @Param("id") Long id);


    /**
     * Update text order type.
     *
     * @param textOrderType the text order type
     * @param id            the id
     */
    @Update("UPDATE t_assignment_resource SET text_order_type = #{textOrderType}, update_time = update_time + 1 WHERE id = #{id}")
    void updateTextOrderType(@Param("textOrderType") Integer textOrderType, @Param("id") Long id);
}
